﻿#region Copyright © Marian Placko 2010-2011

//
// All rights are reserved. Reproduction or transmission in whole or in part,
// in any form or by any means, electronic, mechanical or otherwise, is
// prohibited without the prior written consent of the copyright owner.
//

#endregion

using System.Diagnostics;
using System.Globalization;
using System.Windows.Forms;

namespace MarianPlacko.SqlSmartSecurity
{
    /// <summary>
    /// The about box form class of an Add-In.
    /// </summary>
    internal partial class AboutBox : System.Windows.Forms.Form
    {
        /// <summary>
        /// The non-parametric class constructor.
        /// </summary>
        public AboutBox()
        {
            InitializeComponent();

            Text = Resources.Resources.tabpnlAbout;

            // NOTE: the additional resource: http://www.itblogs.info/index.php/2010/04/04/tablelayoutpanel-can-hold-only-one-contr?blog=3 => TableLayoutPanel can hold only one control

            About_lblProductHeader.Text = Resources.Resources.About_lblProductHeader;
            About_lblVersionHeader.Text = Resources.Resources.About_lblVersionHeader;
            About_lblCopyrightHeader.Text = Resources.Resources.About_lblCopyrightHeader;
            About_lblUrlHeader.Text = Resources.Resources.About_lnkUrlHeader;
            About_lblDescriptionHeader.Text = Resources.Resources.About_txtDescriptionHeader;
            About_lblWarningHeader.Text = Resources.Resources.About_lblWarningHeader.ToUpper(CultureInfo.InvariantCulture);
            About_lblProductText.Text = About.AssemblyProduct;
            About_lblVersionText.Text = About.AssemblyVersion;
            About_lblCopyrightText.Text = About.AssemblyCopyright;
            About_lnkUrlText.Text = Resources.Resources.About_lnkUrlText;
            About_txtDescriptionText.Text = About.AssemblyDescription;
            About_lblWarningText.Text = Resources.Resources.About_lblWarningText.ToUpper(CultureInfo.InvariantCulture);
        }

        /// <summary>
        /// The caption text property of the about box form.
        /// </summary>
        public override sealed string Text
        {
            get { return base.Text; }
            set { base.Text = value; }
        }

        /// <summary>
        /// The clicked event for the URL link.
        /// </summary>
        /// <param name="sender">A sender.</param>
        /// <param name="e">The LinkLabelLinkClickedEventArgs event.</param>
        private void LnkUrlText_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var lnkLabel = (LinkLabel)sender;
            Process.Start(lnkLabel.Text);
        }
    }
}